UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QdeUOdGq5LiuOazVOvO3elr8/N3G6b561bfl7Z2T49o=' 
WHERE 
  key_id = 'a42859834f8ab18e2bfa02672f9ed9d8a13566e1afbbd10c40c96e087877f54f' 
  AND (
    token = 'QdeUOdGq5LiuOazVOvO3elr8/N3G6b561bfl7Z2T49o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042