UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KMTw0UK5afr54JpYBf28XdA3WJceSgmFWGMOFtX1YJc=' 
WHERE 
  key_id = '2f5833d826a592c78539171c7fbbcfc663ab5a6cc3cb1a79fa8f267f4f6cefdb' 
  AND (
    token = 'KMTw0UK5afr54JpYBf28XdA3WJceSgmFWGMOFtX1YJc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036