UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ovqG7iFS2bukxOjwnwc3Dwrs1+sYot58oprPPkaxq2o=' 
WHERE 
  key_id = '8a3ba175e9e7b36e379dffe5de28a47e1743eed6331aaeee1e23745e367cffb9' 
  AND (
    token = 'ovqG7iFS2bukxOjwnwc3Dwrs1+sYot58oprPPkaxq2o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043