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