UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MMyMoVfAyitTOXtM4Ty8ZsOWiTdSBO3UHaznmxtWFFs=' 
WHERE 
  key_id = '9e44ebc190e8fc52baa85292cff77218f0dc7b53420e187c37198e49f68b809d' 
  AND (
    token = 'MMyMoVfAyitTOXtM4Ty8ZsOWiTdSBO3UHaznmxtWFFs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023