UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TXi3uunE+PoivynAAuqAaAGBOgvNqf2NIftuzb5bK4A='
WHERE
key_id = 'e9581df9efca99f772ee607f32d5464df1ca053465609ab43002c73f72f28080'
AND (
token = 'TXi3uunE+PoivynAAuqAaAGBOgvNqf2NIftuzb5bK4A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)