UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q29qf1iJ2WRQOQw6eJexCwhZ5Uk1EvkeQVbU0UMR6Fs='
WHERE
key_id = '049bcfd222ff6d7661818be29993e784f4eef0af4d6a2d3645a81306cf7e3c11'
AND (
token = 'Q29qf1iJ2WRQOQw6eJexCwhZ5Uk1EvkeQVbU0UMR6Fs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)