UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zq7aek3J+nWmjTSGpI7mFvSZaAYiGitm1mViiPFDqFg=' 
WHERE 
  key_id = 'c4328769ef71d1b1c6a3f8017054c5abb122d29bd7ddb34a0965a1f4ebc62705' 
  AND (
    token = 'Zq7aek3J+nWmjTSGpI7mFvSZaAYiGitm1mViiPFDqFg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049