UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v3rCUgvA+wrWkIlaDIoCAkchDybQEDZwQBYy0tIb+tM='
WHERE
key_id = '3ec5bbd16e9d159b5e6301fe853e0e4e4f536bd5a738bb3e7019a30bdf4a19c0'
AND (
token = 'v3rCUgvA+wrWkIlaDIoCAkchDybQEDZwQBYy0tIb+tM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)