UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JN43qo7TrAAmwh35lDEKwrmPdjPdVzRIl7CsOa54yDM=' 
WHERE 
  key_id = '0389f60875fb98924deaad7472dce1f1051555a1032f1ef519b1b5ac73e98794' 
  AND (
    token = 'JN43qo7TrAAmwh35lDEKwrmPdjPdVzRIl7CsOa54yDM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052