UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N4g/3sxquowy1V+/hYlPD9IdvA0aJgt1jF2DiHnq7sA=' 
WHERE 
  key_id = '8457af90723b6e6193d1df835741c133623fd1535f5b4fed5dd2843aa1788b98' 
  AND (
    token = 'N4g/3sxquowy1V+/hYlPD9IdvA0aJgt1jF2DiHnq7sA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029