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