UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aj/GHbYr2XFApYsFzfF2IVl/wAMk8gnIrOKGtWTaDmQ=' 
WHERE 
  key_id = '4881a24855df4edf5a550178868f32dd11e73adb2d0e3545e7587c08a4814b24' 
  AND (
    token = 'aj/GHbYr2XFApYsFzfF2IVl/wAMk8gnIrOKGtWTaDmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022