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