UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'emx6ja8qaI1ZHNFAVUAj7O7Dcd7ulHWtxyvGoWj1vBQ=' 
WHERE 
  key_id = 'd33a6c8962e7d6d957fadf0fa56c6f52927e6d44a4e7813ce86fb9a85ffda160' 
  AND (
    token = 'emx6ja8qaI1ZHNFAVUAj7O7Dcd7ulHWtxyvGoWj1vBQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021