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

Query time 0.00031