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