UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'asoyM8KT3M5r54ppBk1l+HYDfDWVdproaGcWP05cMME=' 
WHERE 
  key_id = 'fe6c18aa7d744d61873dd397f9118b536b501f524a996ee2fffabaf847314f1d' 
  AND (
    token = 'asoyM8KT3M5r54ppBk1l+HYDfDWVdproaGcWP05cMME=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028