UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V7L5eqbaCVerysHqm44SsUqpPfmrsRg81XMuSSF+v6Y=' 
WHERE 
  key_id = 'f5e8a060978683f4b516643fdfa068a881ff79d8002542c2301933ae8ef074e8' 
  AND (
    token = 'V7L5eqbaCVerysHqm44SsUqpPfmrsRg81XMuSSF+v6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044