UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ffZm+Bw/cMra0snb1q/3XZ+7PYKHAyILF2d/MxnjnGg='
WHERE
key_id = 'e8771993ec2cad01ef1efefff9ab2c0306619bff6cc288984520aa79377ff29d'
AND (
token = 'ffZm+Bw/cMra0snb1q/3XZ+7PYKHAyILF2d/MxnjnGg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)