UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v9erhNriUk8QQDGseN6vrkidvd7282KNFCczoqGA1PA=' 
WHERE 
  key_id = '17f30b08f2d53c9f450fd9501f8a5494a21e6e78490cf19c113cb86e48cd78ae' 
  AND (
    token = 'v9erhNriUk8QQDGseN6vrkidvd7282KNFCczoqGA1PA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046