UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zPNmdOvN2lvl3os425zABWMO2usjVNuqHKtMy28pjII=' 
WHERE 
  key_id = '27a6d93d097f54bf25766fe336b772930fd5eac4fc15f4394c243c700e1bb87a' 
  AND (
    token = 'zPNmdOvN2lvl3os425zABWMO2usjVNuqHKtMy28pjII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052