UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qOnTMhTfbeHV3pcnhpMKyGe6ult1wcAAGFglMKdPigY=' 
WHERE 
  key_id = '50260e536f74d446b84335bd37e68a11d55b8944f1f4d7a5181c9ebac09fd205' 
  AND (
    token = 'qOnTMhTfbeHV3pcnhpMKyGe6ult1wcAAGFglMKdPigY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035