UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KnaeSYK997WT8t552YJyW4iAqKDcdYEaJLndl7e8O98='
WHERE
key_id = '20382679621a0b0bffbcd710ec37993addaa1450982fde11cc4ceb0b069fdb06'
AND (
token = 'KnaeSYK997WT8t552YJyW4iAqKDcdYEaJLndl7e8O98='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)