UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N7t6CWfaZT+864TEs9EFqyerKtfwoh6kb0aZQaVoMeg=' 
WHERE 
  key_id = '8b235cc8f767401c7372d8136a828b15b70b8be9b9735533fbdb89c86e56d503' 
  AND (
    token = 'N7t6CWfaZT+864TEs9EFqyerKtfwoh6kb0aZQaVoMeg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045