UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jYfw+FEceCReQdDcfQxnvcrwNOWAAgrqnlH/pONxLGI=' 
WHERE 
  key_id = 'e78641e61ee7940fb19220349b953a1bf8428d57882b9d7f68f97e4bb74e2e8f' 
  AND (
    token = 'jYfw+FEceCReQdDcfQxnvcrwNOWAAgrqnlH/pONxLGI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039