UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G6K6wJo8OqWGo9P33WNBzzS1Ztagm2GQWxcOFpKT7Ag='
WHERE
key_id = '5bfb112e13bc46b007d4e5483b8841cd8951173b69d9320c5fe4e4a3a48810d3'
AND (
token = 'G6K6wJo8OqWGo9P33WNBzzS1Ztagm2GQWxcOFpKT7Ag='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)