UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dsso0tQXehl95xOT78sym/tesktTpuLXdsVTe9jFlW0=' 
WHERE 
  key_id = '77160adb30eeefc32895cffd97349751742fdb18c9c7267b3874f90ad59de480' 
  AND (
    token = 'dsso0tQXehl95xOT78sym/tesktTpuLXdsVTe9jFlW0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032