UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wbft5sBnE9JMTjv/B73aVB8qctSvnGlh+wRwPMvZJZE=' 
WHERE 
  key_id = '2c26f0de960e3623bf217e12e22a8782ff21426088408086e1666baa15258550' 
  AND (
    token = 'Wbft5sBnE9JMTjv/B73aVB8qctSvnGlh+wRwPMvZJZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028