UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h0wVxF3vXzZrL1oMEUwjwrY4DxIK4dqTn0KtZO0mM/4=' 
WHERE 
  key_id = '3b581a3326b246a81c14fa6df7000525a76ba8f09c6f21e5471d7b0b2a50251d' 
  AND (
    token = 'h0wVxF3vXzZrL1oMEUwjwrY4DxIK4dqTn0KtZO0mM/4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046