UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rkT9WwHzsYdI9yAzktF1Kq/Uk7icDLBnI4JHs58/Ips=' 
WHERE 
  key_id = '7d51ad00bc63f6925d23a908ab88f1ee78162b7d54505ab4b6aed5fc2031fb79' 
  AND (
    token = 'rkT9WwHzsYdI9yAzktF1Kq/Uk7icDLBnI4JHs58/Ips=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029