UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Zdw50oBng5G9SWCr9g5dMDuOnd70qJ+gyG1e8sb3z8g='
WHERE
key_id = '78c74f32637efeb30de835606357b0b8ddf112d470d88228f0e4126b9df01429'
AND (
token = 'Zdw50oBng5G9SWCr9g5dMDuOnd70qJ+gyG1e8sb3z8g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)