UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3T5fCM8CUKi3udOITqimSFKl5+YTd4aGp5Sh7KYMwkg=' 
WHERE 
  key_id = 'dc091940d4728ed529bbd102a9009dd788206200717abbb17c6adb241e67db4b' 
  AND (
    token = '3T5fCM8CUKi3udOITqimSFKl5+YTd4aGp5Sh7KYMwkg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034