UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LTiHga/c9yV/KQhV0oj5Bs5Tpw2FqqHj+YSb3uJmqPM=' 
WHERE 
  key_id = 'e2661345217924020da0804c6bec736906011c612a860550dd7b432dfbc91e50' 
  AND (
    token = 'LTiHga/c9yV/KQhV0oj5Bs5Tpw2FqqHj+YSb3uJmqPM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035