UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hQFLBJrrDsVOp56DdBFpCz5eOvVdJBETbE1O4BTrVZM='
WHERE
key_id = 'b82d9fb2b16c496709bbe9f137210255cddd08a848dfe1f5656e75c5e3d315a3'
AND (
token = 'hQFLBJrrDsVOp56DdBFpCz5eOvVdJBETbE1O4BTrVZM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)