UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MMifq42dL+iRzAngzxSIKzyrxiBfd0bkkovWWXVrou0=' 
WHERE 
  key_id = 'a584804a84d7016cc62d8c5f463e7c7b3a6536eb23ae312b2b63fa07887e944f' 
  AND (
    token = 'MMifq42dL+iRzAngzxSIKzyrxiBfd0bkkovWWXVrou0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048