UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C5OioXNNPzGvueVtPOF05qo4W5KTbnKdk/tGFTP8Sw4='
WHERE
key_id = '84879c6e60d56a8ec97db90508589d31af8d8a3f7801d4847ca3a95c610ddcc3'
AND (
token = 'C5OioXNNPzGvueVtPOF05qo4W5KTbnKdk/tGFTP8Sw4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)