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

Query time 0.00037