UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Cai8YAOgBL4ZikUVvg829js/lQhKmxSa5wkkS7xY1l4='
WHERE
key_id = '438fdd5a3750849b296f5927ba4fba9a23d8fe5b27ab776bfa252f14a9f3d061'
AND (
token = 'Cai8YAOgBL4ZikUVvg829js/lQhKmxSa5wkkS7xY1l4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)