UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dw1hJy2Bum+y89IWG9lR06PdqUmQAnPHX2nueLgZy6U=' 
WHERE 
  key_id = 'ed316550d6d0c5a10ac80649ee311c4147c63e71ff9fa52f95c55b5d6f72ecf9' 
  AND (
    token = 'dw1hJy2Bum+y89IWG9lR06PdqUmQAnPHX2nueLgZy6U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040