UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pIGe2moGgg8JwC4YegF0IpQvp6hcpg6w8OH212M7qdA=' 
WHERE 
  key_id = '31b6bab7472eb0fb50fbfdcac8d2035766125ed14689b64477088fa2ab3dc20d' 
  AND (
    token = 'pIGe2moGgg8JwC4YegF0IpQvp6hcpg6w8OH212M7qdA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046