UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yUNqHsdxqNx74TJRihaz50dgsnxUKtJsOOkZAJFgCKk=' 
WHERE 
  key_id = '49a62d4a488740f96c3c0bba45e60574586504868558e9900279a4052e199765' 
  AND (
    token = 'yUNqHsdxqNx74TJRihaz50dgsnxUKtJsOOkZAJFgCKk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032