UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YZeuihyDboj9ehSr6GV7klDGoX69u27WtSnOMAlStkY=' 
WHERE 
  key_id = 'cbda8f6da222085a9dca187ad2d5217192b14e812c13adf30c7c65f6a1237363' 
  AND (
    token = 'YZeuihyDboj9ehSr6GV7klDGoX69u27WtSnOMAlStkY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023