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

Query time 0.00042