UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qfjhH3pAW4gCws6LHprhjdMjNYeobUMDYCqAU37Voso=' 
WHERE 
  key_id = '6ace28f42dd2a5f0e6bd408fba7965722b2b839682aec27c83cb21de262af18d' 
  AND (
    token = 'qfjhH3pAW4gCws6LHprhjdMjNYeobUMDYCqAU37Voso=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019