UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HDWEv1y6O0fKpzkEi5ZcXxlgYHEXmypsK6BuaL0UMPM=' 
WHERE 
  key_id = '2cedbbc992d2b6b35611c871dfe68847bf1d312320c89dde24fac145463c1bb7' 
  AND (
    token = 'HDWEv1y6O0fKpzkEi5ZcXxlgYHEXmypsK6BuaL0UMPM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057