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

Query time 0.00037