UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ydmhRQyqcfZg0xCDuV5ZfRoavmuOWQe9JRVVktJ/w80=' 
WHERE 
  key_id = '51ed74b63bbe5325deaeafc4e882011aefc7f7210d8b8f6559d953cc710786c4' 
  AND (
    token = 'ydmhRQyqcfZg0xCDuV5ZfRoavmuOWQe9JRVVktJ/w80=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019