UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YtLJdqW4LQbOe6bjZ0i766W9g7OL1LXo+OzqShqmb1M='
WHERE
key_id = '8dc3ce97d55ebc221e008c2221885b0a99d810f58d353a3931244195b52d5f7b'
AND (
token = 'YtLJdqW4LQbOe6bjZ0i766W9g7OL1LXo+OzqShqmb1M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)