UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WI2TM7aDdfOwlEhZKSNXaLFp1GTabIxf/YE60rtflIw='
WHERE
key_id = 'abffe54d590083f3709930c923a7b005f470fd3635b88bb37b4dd41c9fe79ee7'
AND (
token = 'WI2TM7aDdfOwlEhZKSNXaLFp1GTabIxf/YE60rtflIw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)