UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cc6CXJdniTpYUm8G7CFv8s39NJ2BLl8NAmQPo7ansnE=' 
WHERE 
  key_id = '93f1656e46d84135beec8b65fa786656081e19c1e21351d9b2e34ffc860820c5' 
  AND (
    token = 'Cc6CXJdniTpYUm8G7CFv8s39NJ2BLl8NAmQPo7ansnE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029