UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rFzTOFw4qRiDLAZsaoUOayhaBVrq5SLRaaSaNxFfpVc=' 
WHERE 
  key_id = '7f1961feec4b03897a18d6166d968094fbb7c4253bc4cec4c1fd24665d8e3f40' 
  AND (
    token = 'rFzTOFw4qRiDLAZsaoUOayhaBVrq5SLRaaSaNxFfpVc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047