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