UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gCLgm8Q4AKNIbKf3Bl61OqF8MD5RKxN7TFuDn0UqIO0='
WHERE
key_id = '80c5caf1b8c2ebfbac26af137ca011fd67a0380798dfe1dac2a1abdf7a653228'
AND (
token = 'gCLgm8Q4AKNIbKf3Bl61OqF8MD5RKxN7TFuDn0UqIO0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)