UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fRAx9EedlLNuKX0uoPhhlNLn0JYiAwPQjAPYw8qrJHk=' 
WHERE 
  key_id = '862025cb66bd49bad96777615271c0c4fb6171ed16386c54c1ad7baa344db336' 
  AND (
    token = 'fRAx9EedlLNuKX0uoPhhlNLn0JYiAwPQjAPYw8qrJHk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047