UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zj3w6kW5RplplYRoInCqycbvyQ9CUfBBFWu0QwqwfXc=' 
WHERE 
  key_id = '29c5c191b7f7db8e2856a4bfaf39befcc8f227d9a691ddb204ea1fd587469fa5' 
  AND (
    token = 'Zj3w6kW5RplplYRoInCqycbvyQ9CUfBBFWu0QwqwfXc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036