UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cX6vuheLzaTNmXOSZ7BzZHDRxGalMBBsAdk1B+eWD7k='
WHERE
key_id = 'de82e1e766f6146280f761d85aa75fec9c76e79a48dac14ade466ac07fe3f5ff'
AND (
token = 'cX6vuheLzaTNmXOSZ7BzZHDRxGalMBBsAdk1B+eWD7k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)