UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LhMGbNORl6P2ZV885W079D9ZRqjj5GWFMd8buHlCgx0=' 
WHERE 
  key_id = '716ae408887c0b87f56e084cb19b6784a339b0c6ace6806ea1b7206fcf1bafbc' 
  AND (
    token = 'LhMGbNORl6P2ZV885W079D9ZRqjj5GWFMd8buHlCgx0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047