UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h98nd7FG1i5qFRLbhcATGttiB1Pcn8FpCDkd50+10Dk='
WHERE
key_id = '8884ef63f0933adfe6c2b9fec394261a9a8bce10808a226ecd1f652e7065b0ea'
AND (
token = 'h98nd7FG1i5qFRLbhcATGttiB1Pcn8FpCDkd50+10Dk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)