UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V7zYMO2SLDGQw0oWbBQG1St0tgXe7u4+/G6YgjF/E3g='
WHERE
key_id = '7e816eb47b3498d677254140826fb7e6ac6d91cd034c5ed3fdb36d2fd191780f'
AND (
token = 'V7zYMO2SLDGQw0oWbBQG1St0tgXe7u4+/G6YgjF/E3g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)