UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IDXX8ZdNGnHu3W/REE/Mb80RJVjnRVZNXHKRyIFonzU='
WHERE
key_id = 'eafe6eed8775f25b31f9046e3a5acd945833036ecf5dcd33e90f6fd6dde5232a'
AND (
token = 'IDXX8ZdNGnHu3W/REE/Mb80RJVjnRVZNXHKRyIFonzU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)