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